import React,{useState,useEffect} from 'react';
import { EChartsOption } from 'echarts'
import { data_kdata } from '../api/api'
import Echart from './index';

function K(props) {
    var [Kx,setKx] = useState([])
    var [Ky,setKy] = useState([])
    useEffect(()=>{
      data_kdata().then((res)=>{
        console.log(res.data.data.x,res.data.data.val);
        Kx = res.data.data.x
        setKx([...Kx])
        Ky = res.data.data.val
        setKy([...Ky])
      })
    },[])
  const option = {
      xAxis: {
        data: Kx
      },
      yAxis: {},
      series: [
        {
          type: 'candlestick',
          data: Ky
        }
      ]
    };
    return (
        <Echart option={option}/>
    );
}

export default K;